package vtc;

import java.util.*;
import java.util.concurrent.*;
import java.io.*;

// Many input queues and one single output queue

abstract class ConcentratorUnit extends VtcUnit 
{
	
	VtcTimeTaggedEvent event_;
	
	ConcentratorUnit(String id, VtcArrayBlockingQueue inQueues[], VtcArrayBlockingQueue outQueues[]) 
	{
		super(id, inQueues, outQueues);
		event_ = null;
	}
	
	abstract public void concentratorProcess() throws InterruptedException;
	
	public void process() throws InterruptedException
	{
		concentratorProcess();
		if(event_ != null)
		{
			outQueues_[0].forcePut(event_);
			event_ = null;
		}
	}
}